import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Main = () => import('../views/shopCar/Shop-child/shop-main.vue');
const Goods = () => import('../views/shopCar/Shop-child/shop-goods.vue');
const Fruit = () => import('../views/shopCar/Shop-child/shop-fruit.vue');
const Snacks = () => import('../views/shopCar/Shop-child/shop-snacks.vue');
const Share = () => import('../views/shopCar/Shop-child/bodys/pinks/share.vue');

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
    // 登录模块
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index')
  },
  {
    path: '/sign',
    name: 'sign',
    component: () => import('../views/login/sign')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/login/register')
  },
  {
    path: '/index',
    component: () => import('../views/index/index.vue'),
    children: [
      {
        path: '/',
        component: () => import('../views/index/mainpage')
      },
      {
        path:'/qujian',
        name:'qujian',
        component:()=> import('../views/index/qujian.vue')
        },
        {
          path:'/userMine',
          name:'userMine',
          component:() => import('../views/userMine/mine.vue')
        }
      ]
  },
  {  // 首页商品详情
    path: '/shop/:id',
    name: 'Shop',
    component: () => import('../components/common/shop')
  },
  {  // 购物车商品详情
      path: '/gou/shop/:id',
      name: 'shop',
      component: () => import('../components/common/shop')
  },
  {//我的--设置
    path: '/settings',
    name:'settings',
    component:() => import('../views/userMine/subPageOfMine/settings')
  },
  {//我的--我的卡券
    path:'/myCard',
    name:'myCard',
    component:() => import('../views/userMine/subPageOfMine/myCard')
  },
  {//我的--我的卡券--优惠码
    path: '/saleCard',
    name:'saleCard',
    component:() => import('../views/userMine/subPageOfMine/saleCode/saleCode')
  },
  {//我的--我的亲友
    path:'/myFriends',
    name:'myFriends',
    component:() => import('../views/userMine/subPageOfMine/importPackage')
  },
  {//我的--寄件记录
    path:'/sendRecord',
    component:() => import('../views/userMine/subPageOfMine/sendRecord'),
    children: [
      {//重定向为进行中
        path:'/',
        redirect:'/loading'
      },
      {//进行中作为首页
        path: '/loading',
        name:'loading',
        component:() => import('../views/userMine/subPageOfMine/sendRecordRouterPage/loading')
      },
      {//已寄出
        path:'/finished',
        name:'finished',
        component:() => import('../views/userMine/subPageOfMine/sendRecordRouterPage/finished')
      },
      {//取消
        path: '/canceled',
        name:'canceled',
        component:() => import('../views/userMine/subPageOfMine/sendRecordRouterPage/canceled')
      }
    ]
  },
  {//我的--会员中心
    path:'/vip',
    name:'vip',
    component:() => import('../views/userMine/subPageOfMine/vip')
  },
  {//我的--裹酱积分
    path:'/integral',
    name:'integral',
    component:() => import('../views/userMine/subPageOfMine/integral')
  },
  {//我的--导入包裹
    path:'/importPackage',
    name:'importPackage',
    component:()=> import('../views/userMine/subPageOfMine/importPackage')
  },
  {
    path: '/introduction',
    name:'introduction',
    component:()=>import('../views/userMine/subPageOfMine/importPackageSubPage/introduction')
  },
  {//我的--包裹通知设置
    path:'/inform',
    name:'inform',
    component:() => import('../views/userMine/subPageOfMine/inform')
  },
  {//我的--免打扰
    path:'/noDisturb',
    name:'noDisturb',
    component:() => import('../views/userMine/subPageOfMine/noDisturb')
  },
  {//我的--版本切换
    path:'/change',
    name:'change',
    component:() => import('../views/userMine/subPageOfMine/change')
  },
  {
    path:'/identityCode',
    name:'identityCode',
    component:() => import('../views/userMine/subPageOfMine/identityCode')
  },
  {//我的--客服中心
    path:'/talking',
    name:'talking',
    component:() => import('../views/userMine/subPageOfMine/talking')
  },
  {//我的--客服中心--物流客服
    path: '/consult',
    name:'consult',
    component:() => import('../views/userMine/ServeCenterSubPage/consult')
  },
  {
    path:'/find',
    name:'find',
    component:() => import('../views/userMine/subPageOfMine/find')
  },
  {
    path:'/nameGoCode',
    name:'nameGoCode',
    component:() => import('../views/userMine/subPageOfMine/nameGoCode')
  },
  {
    path:'/address',
    name:'address',
    component:() => import('../views/userMine/subPageOfMine/address')
  },
  {
    path:'/nameCode',
    name:'nameCode',
    component:() => import('../views/userMine/subPageOfMine/nameCode')
  },
  {
    path:'/shopCar',
    name:'shopCar',
    redirect: '/shopCar/cngg/ggg/main',
    component:() => import('../views/shopCar/Shop.vue'),
    children:[
      {
        path:'/shopCar/cngg/ggg/main',
        component:Main
      },
      {
        path:'/shopCar/cngg/ggg/goods',
        component:Goods
      },
      {
        path:'/shopCar/cngg/ggg/snacks',
        component:Snacks
      },
      {
        path:'/shopCar/cngg/ggg/fruit',
        component:Fruit
      },
      {
        path:'/shopCar/share',
        component: Share
      }
    ]
  },
  {
    path:'/qujian/qujian-add',
    name:'qujian-add',
    component:() => import('../views/index/qujian-add')
  },
  {
    path: '/shopCar/myCart',
    name: 'myCart',
    component: () => import('../views/shopCar/myCart/myCart.vue'),
  },
  {
    path:'/Scroll',
    name:'Scroll',
    component: () => import('../views/shopCar/scroll.vue')
  },
  {
    path:'/Drawer',
    name:'Drawer',
    component: () => import('../views/shopCar/drawer.vue')
  },
  {
    path: '/shopCar/order',
    component: () => import('../views/shopCar/Shop-order/shop-order.vue'),
    children:[
      {
        path:'/',
        redirect:'/shopCar/order/all'
      },
      {
        path: '/shopCar/order/all',
        component:() => import('../views/shopCar/Shop-order/all.vue')
      },
      {
        path:'/shopCar/order/pay',
        component:() => import('../views/shopCar/Shop-order/pay.vue')
      },
      {
        path:'/shopCar/order/send',
        component:() => import('../views/shopCar/Shop-order/send.vue')
      },
      {
        path:'/shopCar/order/receiv',
        component:() => import('../views/shopCar/Shop-order/receiv.vue')
      },
      {
        path:'/shopCar/order/evaluate',
        component:() => import('../views/shopCar/Shop-order/evaluate.vue')
      }
    ]
  },

    // 修改地址
  {
    path: '/find/:id',
    name: 'find_update',
    component: () => import('../views/userMine/subPageOfMine/find_update')
  },
    // 查包裹
  {
    path: '/search',
    name: 'search',
    component: () => import('../components/common/search')
  },
    // 寄件
  {
    path: '/send',
    name: 'send',
    component: () => import('../views/send/send')
  }
]
const router = new VueRouter({
  routes
})
export default router
